Diagnostic data capture

ABSTRACT

Statistical sampling of diagnostic data within an apparatus for processing data 2 is performed based upon sample interval monitoring and address monitoring. A program instruction has its diagnostic data stored when it meets a sample interval criteria and an address match criteria. The address match may correspond to an instruction address of the program instruction or a target address to be read or written by the program instruction.

This disclosure relates to the field of data processing systems. More particularly, this disclosure relates to the capture of diagnostic data within data processing systems.

An important feature of increasingly complex data processing systems is that they include mechanisms and support for capturing diagnostic data in order that errors in the hardware and software can be identified and solved. It is desirable that the capture of diagnostic data should not disturb the normal operation of the data processing system. For example, if capturing the diagnostic data significantly slowed the operation of the data processing system, then this could result in some speed related errors either not arising during the capture of the diagnostic data when they arise in normal use or arising during the capturing of the diagnostic data when they would not arise during normal use. Furthermore, it is desirable that the amount of storage and other resources required for capture of diagnostic data should be low as these represent an overhead which would not normally be used during deployed operation of the data processing system when diagnostic data capture is not required.

At least some embodiments of the present disclosure provide apparatus for processing data comprising:

diagnostic data capture circuitry to control storing to a diagnostic data buffer of sampled diagnostic data characterizing a sampled processing operation within a stream of processing operations when:

-   -   said sampled processing operation is separated from a preceding         sampled processing operation having sampled diagnostic data         stored to said diagnostic data buffer by an interval matching a         predetermined interval condition; and     -   said sampled processing operation has an associated memory         address matching a predetermined address characteristic.

At least some embodiments of the present disclosure provide apparatus for processing data comprising:

diagnostic data capture means for controlling storing to a diagnostic data buffer of sampled diagnostic data characterizing a sampled processing operation within a stream of processing operations when:

-   -   said sampled processing operation is separated from a preceding         sampled processing operation having sampled diagnostic data         stored to said diagnostic data buffer by an interval matching a         predetermined interval condition; and     -   said sampled processing operation has an associated memory         address matching a predetermined address characteristic.

At least some embodiments of the present disclosure provide a method of processing data comprising:

storing to a diagnostic data buffer of sampled diagnostic data characterizing a sampled processing operation within a stream of processing operations when:

-   -   said sampled processing operation is separated from a preceding         sampled processing operation having sampled diagnostic data         stored to said diagnostic data buffer by an interval matching a         predetermined interval condition; and     -   said sampled processing operation has an associated memory         address matching a predetermined address characteristic.

Example embodiments will now be described, by way of example only, with reference to the accompanying drawings in which:

FIG. 1 schematically illustrates an example embodiment of a data processing system incorporating diagnostic data capture circuitry;

FIG. 2 is a flow diagram schematically illustrating a sampling process;

FIG. 3 is a flow diagram schematically illustrating an address matching process;

FIG. 4 is a flow diagram schematically illustrating a sample filtering and storing process; and

FIG. 5 schematically illustrate a further example embodiment of a data processing system incorporating diagnostic data capture circuitry.

FIG. 1 schematically illustrates a data processing apparatus 2 including a memory 4 (storing program instructions to be executed and data to be manipulated), a fetch unit 6, an instruction dispatch unit 8 and execution pipelines 10. In operation, the fetch unit 6 fetches program instructions from the memory 4. These fetched program instructions are then at least partially decoded (not illustrated) and passed to the instruction dispatch unit 8 where they await dispatch to the execution pipelines 10. The execution pipelines 10 perform the processing operation(s) specified by the program instructions. It will be appreciated that in practice, the data processing apparatus 2 will typically include many further units providing other functionality to the data processing apparatus 2, but these have been omitted from FIG. 1 for the sake of clarity.

The data processing apparatus 2 of FIG. 1 is able to perform statistical sampling of the program instructions which are executed. These program instructions may more generally be considered to be a stream of processing operations. The present techniques could be applied to different embodiments in which the processing operations upon which the statistical sampling to be performed are not program instructions, e.g. the processing operations could be interrupts received by a interrupt controller or memory transactions upon a system-on-chip interconnect.

The statistical sampling performed in accordance with the present disclosure serves to record diagnostic data within a diagnostic data buffer 12. The selection of for which program instructions (processing operations) within the stream the diagnostic data is to be captured is based upon satisfying two criteria. The first criterion is that the program instruction (processing operation) should be separated from a preceding sampled program instruction (processing operation) by an interval (either number of processing operations or time) within the stream of program instructions that matches a predetermined interval condition. In this example embodiment, the predetermined interval condition is that the sampled diagnostic data is separated from a preceding sampled processing operation by a predetermined interval that is an positive integer multiple of a base sampling period. Furthermore, the sample processing operation in order to have its diagnostic data captured should have an associated memory address matching a predetermined address characteristic.

In the example illustrated in FIG. 1, these two criteria are applied in the order of first requiring that a candidate program instruction to be sampled should be separated from the immediately preceding candidate program instruction by a predetermined (programmable) sampling interval. Once the candidate program instructions within the stream of program instructions have been identified based upon the sampling interval, then a further selection is made among these candidate program instructions based upon whether or not the candidate program instructions have an associated memory address matching a predetermined address characteristic.

The associated memory address could take a variety of forms. For example, the associated memory address for a candidate program instruction may be the memory address storing that program instruction within the memory 4. Alternatively, the associated memory address may be a target address accessed by that candidate program instruction when it is executed, e.g. a read address or a write address associated with a data access instruction (load or store) or a data processing instruction (e.g. add) that is executed.

FIG. 1 illustrates interval selection circuitry 14 which is initialized with an interval count value from a programmable statistical sampling configuration register 15. Each time a program instruction is dispatched from the instruction dispatch unit 8, the count value is decremented until it reaches zero. It should be noted that the term “dispatched” can be used in a variety of ways in this technical field and the present techniques are not limited by any particular usage of this term. When the count value reaches zero, then this corresponds to “a sampling interval hit” the corresponding instruction is marked as the sampled one. This might take the form of a tag that travels with the instruction through the pipeline that is examined to determine whether this is the sampled instruction, or a record somewhere of a tag value for the instruction that is compared against tag values of instructions in the pipeline to determine whether this is the sampled instruction, or some combination of these and other means. The execution pipelines 10 then store characteristics of the marked instruction within sampled instruction record storage 16 as the marked instruction makes its way through the execution pipelines 10 until it is completed and retired. Thus, the interval selection circuitry 14 in this example embodiment serves to mark dispatched instructions separated within the stream of program instructions by a programmable sampling interval. In the above described example embodiment the sampling is at the point where the instructions are dispatched. In other example embodiments, the sampling may occur at other points, e.g. before instructions are decoded or when they are issued to the execution units. Not every processing operation separated by an integer multiple of the predetermined interval from the previously sampled processing operation will be sampled (i.e. “a predetermined interval condition”), rather it is a candidate for sampling and will be sampled if it also meets the address criterion discussed below.

As previously mentioned, the associated memory address criteria which is used to filter further which diagnostic data is captured may take the form of the memory address of the program instruction or a target address associated with the program instruction. In the case of the memory address of the program instruction, this may be determined as the fetch unit 6 fetches the program instruction from the memory 4. In the illustrated example embodiment, a breakpoint unit 18 is provided, which is an example of further diagnostic circuitry performing diagnostic operations distinct from the statistical sampling previously discussed. Comparators 20 within the breakpoint unit 18 which may be used by the breakpoint unit 18 to identify the instruction addresses of fetched instructions to trigger an interrupt in processing in accordance with break-pointing of program code, may be reused to serve as comparators identifying whether a fetched program instruction has an associated memory address (i.e. the program instruction address) matching a predetermined address characteristic used for the address filtering criteria of statistical sampling. The breakpoint unit 18 may be programmed to serve as part of the statistical sampling diagnostic data capture circuitry instead of having its normal breakpoint identification function. In this case, when the comparators 20 within the breakpoint unit 18 detect an address match, which may be a full match of the instruction address against a predetermined address, a match corresponding to the instruction address failing within a predetermined range of addresses, or a match whereby one or more bits or bit fields within the associated memory address as specified by a mask (e.g. a mask value specifying a number of bits to be treated as significant by the matching circuitry) match with a predetermined address. Other types of address matching may also be used if desired and supported by the comparators 20. Reusing the comparators 20 within the breakpoint unit 18 rather than providing dedicated comparators to support the address comparison associated with statistical sampling reduces the overhead associated with the provision of statistical sampling.

If an address match is identified by the comparators 20 when these are being used to support statistical sampling, then the program instruction which has resulted in the match is tagged to indicate this as it is passed to the instruction dispatch unit 8. When that instruction is then dispatched to the execution pipelines, then the tag indicating that it corresponds to an address match is stored within the sampled instruction record for that instruction in the sampled instruction record storage 16 such that this information is available when the instruction is completed so a determination (described below) can be made as to whether or not its diagnostic data should be stored within the diagnostic data buffer 12.

As previously mentioned, the associated memory address of a program instruction may be a target address associated with a program instruction. A watchpoint unit 22 which is used to perform data watch-pointing in accordance with a diagnostic technique separate from statistical sampling, may be reused, or at least its comparators 24 reused, in order to identify that a program instruction to be subject to statistical sampling has the predetermined address characteristic by virtue of accessing a target address having predetermined address characteristics. As previously discussed, these characteristics may require a complete match of the address, a match corresponding to the target address falling within a predetermined range, or a match between a partially masked target address value and a predetermined value. Other forms of address matching would also be possible. The watchpoint unit 22 is supplied with target address data by the execution pipelines 10 and the comparators 24 within the watchpoint unit 22 may be used to identify whether a program instruction matches a predetermined address criteria. If such a match arises, then this may be signaled back via the execution pipelines 10 and stored within the sampled instruction record within the sampled instruction record storage 16 for that program instruction.

Address matching may also be performed based upon memory address attribute data indicative of memory attributes associated with regions of memory addresses within the memory 4. Such memory address attribute data may be page table data used by a memory management unit 25 to control access to the memory 4, either by instructions specifying loads or stores, or by the fetching of program instructions by the fetch unit 6 from given regions of the memory 4. The memory attribute data may be page table data to which can be added a flag indicating that a particular page of memory corresponds to an address match for the predetermined address characteristic associated with the statistical sampling, e.g. a candidate program instruction at the required interval will be sampled if it is associated with a memory address from within a page of the memory address space marked by the page tables as to be subject to statistical sampling.

As previously discussed, both the breakpoint unit 18 and the watchpoint unit 22 may have their respective address comparators 20, 24 reused to serve as part of the diagnostic data capture circuitry which performs statistical sampling. When they are being reused in this way, their normal function to trigger an interruption to processing when they detect a breakpoint or a watchpoint is programmably suppressed and instead they generate a suppressed address-match event which corresponds to the satisfying of the address matching between an associated memory address of a candidate program instruction and the predetermined address characteristic for statistical sampling.

The data processing apparatus 2 may also include trace circuitry 26 to generate trace data indicative of program execution flow. This trace circuitry 26 includes comparators 28 used during such tracing operations. These comparators 28 may again be reused as part of the diagnostic data capture circuitry which performs statistical sampling in order to reduce the overhead associated with the provision of such statistical sampling.

As mentioned above, page table data may be used to identify regions of memory addresses which are to be subject to statistical sampling (i.e. for which an address match is indicated). It is also possible that in some embodiments a capability pointer may be used as a pointer to a region of memory and specify permitted operations when using that pointer. Such a capability pointer may be augmented by a flag indicating that the region concerned should be subject to statistical sampling, i.e. provide the address matching criteria.

When a marked program instruction is being retired from the execution pipelines 10 (“retired” could in different example embodiments, refer to different points such as when the effect of the instruction is committed to the architectural state (becomes non-speculative), when it is completed and can no longer effect other instructions (but is still speculative), when the instruction no longer has anything to record in the sample record, or some other point), then its sampled instruction record stored within the sampled instruction record storage 16 is checked to determine whether or not diagnostic data associated with that program instruction should be stored within the diagnostic data buffer 12. Address filtering circuitry 30 is used to check whether the address match flag is set within the sampled instruction record. If the address match flag is set indicating that the address match criteria have been met, then diagnostic data for that sampled instruction is stored within the diagnostic data buffer 12.

In the example of FIG. 1, candidate program instructions to be sampled are identified using the sampling interval. A selection amongst these candidate program instructions is then made based upon whether or not they have an associated memory address matching a predetermined address characteristic. Thus, the operation of the circuitry of FIG. 1 may be considered to perform statistical sampling based upon a count filter and then an address filter.

FIG. 2 schematically illustrates an interval sampling process. At step 32 the counter within the interval selection circuitry 14 is initialized to a count value corresponding to the sampling interval. Step 34 then waits until an instruction is identified as being dispatched by the instruction dispatch unit 8. When an instruction is dispatched, then step 36 decrements the counter. Step 38 determines whether the counter has reached zero. When the counter reaches zero, then step 40 marks the instruction as meeting the sample interval criteria and processing returns to step 34.

FIG. 3 schematically illustrates the address matching process. At step 42 the address filter is initialized, e.g. appropriate programming of the comparators 20, 24, 28 or specific comparators dedicated to the statistical sampling. Step 44 then determines whether or not an address associated with a program instruction matches the predetermined address condition (such as, for example, an exact match, a match within a range or a match subject to specified masking). The address match could be based on the storage address of the program instruction concerned and/or a target address being accessed by the program instruction. When an address match is found, then step 46 determines whether the instruction is one marked as meeting the address match criteria (assuming the address match is being made upon target addresses for instructions that have already been dispatched). If the instruction is so marked, then step 48 records the address match within the sampled instruction record.

FIG. 4 schematically illustrates a sample filtering and storing process. At step 50 the criteria to be used in examination of the sampled instruction record to gate sampling are initialized. Step 52 determines whether a completed instruction is marked as meeting the sample interval criteria within its associated sample instruction record. If the instruction does not meet this criteria, then no diagnostic data is stored for that instruction. If the criteria of the sampling interval is met, then processing proceeds to step 54 where a determination is made as to whether or not the address match criteria is to be applied. If the address match criteria is to be applied, then step 56 determines whether or not the sampled instruction record for the instruction that is completed is marked as having met the address match criteria. If the address match criteria is not met, then no diagnostic data will be stored.

Step 58 schematically represents other criteria checks which may be made in respect of a completed instruction to determine whether or not it is to have diagnostic data associated therewith stored into the diagnostic data buffer 12. These other criteria may go beyond the sampling interval check and the address match check described herein. If all of the criteria are met, then processing proceeds to step 60 where diagnostic data for the completed instruction is stored into the diagnostic data buffer and the sampled instruction record cleared for reuse by another instruction. There may also be checks on the N path from step 56 such that diagnostic data for the completed instruction is stored into the diagnostic data buffer if any of the criteria are met.

FIG. 5 illustrates another example embodiment of a data processing system 62 using statistical sampling. In this example embodiment, circuit elements similar to those described in relation to FIG. 1 will not be described again. The example embodiment of FIG. 5 differs from that of FIG. 1 in that the address filtering criteria is performed based upon the instruction address of a program instruction. The breakpoint unit 18 identifies a stream of candidate program instructions for diagnostic data recording as part of statistical sampling. The stream of candidate program instructions are those instructions for which the address match criteria has been met based upon their instruction address. The interval selection circuitry 14 then counts a (programmable) sampling interval within the stream of candidate program instructions which already match the address criteria. When the interval count reaches zero, then the candidate program instruction at that point is marked as to be sampled. Accordingly, when that instruction is completed it's associated diagnostic data will be stored. The example embodiment of FIG. 5 thus performs an address filtering operation followed by an interval selection upon those program instructions that meet the address filtering criteria. 

1. Apparatus for processing data comprising: diagnostic data capture circuitry to control storing to a diagnostic data buffer of sampled diagnostic data characterizing a sampled processing operation within a stream of processing operations when: said sampled processing operation is separated from a preceding sampled processing operation having sampled diagnostic data stored to said diagnostic data buffer by an interval matching a predetermined interval condition; and said sampled processing operation has an associated memory address matching a predetermined address characteristic.
 2. Apparatus as claimed in claim 1, wherein said diagnostic data capture circuitry comprises interval selection circuitry to select as a candidate processing operation for sampling a processing operation within said stream of processing operations separated by a predetermined interval within said stream from a previously selected candidate processing operation; and address filtering circuitry to control storing of diagnostic data characterizing said candidate processing operation to said diagnostic data buffer as said sampled diagnostic data when said candidate processing operation has an associated memory address matching said predetermined address characteristic.
 3. Apparatus as claimed in claim 1, wherein said diagnostic data capture circuitry comprises address filtering circuitry to select as a candidate processing operation for sampling a processing operation within said stream of processing operations having an associated memory address matching a predetermined address characteristic to form a stream of candidate instructions; and interval selection circuitry to control storing of diagnostic data characterizing said candidate processing operation to said diagnostic data buffer as said sampled diagnostic data when said candidate processing operation is separated by a predetermined interval within said stream of candidate processing operations from a previously sampled processing operation.
 4. Apparatus as claimed in claim 2, wherein said candidate processing operation is a data access processing operation to access a target memory address and said associated memory address is said target address.
 5. Apparatus as claimed in claim 1, wherein said candidate processing operation is stored at an instruction address and said associated memory address is said instruction address.
 6. Apparatus as claimed in claim 1, wherein said associated memory address matching said predetermined address characteristic corresponds to one of: said associated memory address matches a predetermined address; said associated memory address matches a predetermined range of addresses; and bits within said associated memory address specified by a mask match corresponding bits within a predetermined address.
 7. Apparatus as claimed in claim 2, wherein said predetermined interval is one of: a predetermined number of processing operations; and a predetermined time interval.
 8. Apparatus as claimed in 1, wherein said predetermined address characteristic is user programmable.
 9. Apparatus as claimed in claim 2, comprising further diagnostic circuitry to perform a further diagnostic operation associated with execution of said stream, wherein said address filtering circuitry shares with said further diagnostic circuitry diagnostic comparator circuitry to perform address comparisons.
 10. Apparatus as claimed in claim 9, wherein said further diagnostic circuitry is programmable to suppress said further diagnostic operation upon detection of an address match by said diagnostic comparator and instead generate a suppressed address-match event.
 11. Apparatus as claimed in claim 10, wherein said predetermined filter characteristic comprises occurrence of said suppressed address-match event.
 12. Apparatus as claimed in claim 11, wherein said address filtering circuitry is programmable to selectively include occurrence of said suppressed address-match event within said predetermined address characteristic.
 13. Apparatus as claimed in claim 9, wherein said further diagnostic circuitry comprises watchpoint circuitry to trigger an interruption to processing operation execution when a data access is made to a memory address matching a watchpoint characteristic and said diagnostic comparator comprises a watchpoint comparator shared with said address filtering circuitry.
 14. Apparatus as claimed in claim 9, wherein said further diagnostic circuitry comprises breakpoint circuitry to trigger an interruption to processing operation execution when a processing operation is executed having an instruction address matching a breakpoint characteristic and said diagnostic comparator comprises a breakpoint comparator shared with said address filtering circuitry.
 15. Apparatus as claimed in claim 9, wherein said further diagnostic circuitry comprises trace circuitry to generate trace data indicative of processing operation execution flow and said diagnostic comparator comprises a trace point comparator shared with said address filtering circuitry.
 16. Apparatus as claimed in claim 1, comprising memory management circuitry to manage accesses to a memory using memory address attribute data indicative of memory attributes associated with regions of memory addresses within said memory, wherein said predetermined address characteristic of said associated memory address corresponds to a parameter specified in said memory address attribute data for said associated memory address.
 17. Apparatus as claimed in claim 16, wherein said memory address attribute data is memory page table data.
 18. Apparatus as claimed in claim 1, wherein said predetermined address characteristic is part of a capability pointer comprising a pointer to a region of memory and permitted operations when using said pointer.
 19. Apparatus as claimed in claim 1, wherein said stream of processing operations is a stream of program instructions.
 20. Apparatus for processing data comprising: diagnostic data capture means for controlling storing to a diagnostic data buffer of sampled diagnostic data characterizing a sampled processing operation within a stream of processing operations when: said sampled processing operation is separated from a preceding sampled processing operation having sampled diagnostic data stored to said diagnostic data buffer by an interval matching a predetermined interval condition; and said sampled processing operation has an associated memory address matching a predetermined address characteristic.
 21. A method of processing data comprising: storing to a diagnostic data buffer of sampled diagnostic data characterizing a sampled processing operation within a stream of processing operations when: said sampled processing operation is separated from a preceding sampled processing operation having sampled diagnostic data stored to said diagnostic data buffer by an interval matching a predetermined interval condition; and said sampled processing operation has an associated memory address matching a predetermined address characteristic. 